<?php

include('../../include/functions.inc.php');
include('../../include/maintenance.inc.php');

if (!isset($_SESSION['mEntity'])) {
    $mEntity = new Maintenance();

    $mEntity->windowTitle = 'Mantenimiento de Entidades';
    $mEntity->newUrlPage = 'new.php';
    $mEntity->editUrlPage = 'edit.php';
    $mEntity->saveNewUrlPage = 'data.php?operation=s';
    $mEntity->updateUrlPage = 'data.php?operation=u';
    $mEntity->deleteUrlPage = 'data.php?operation=d';
    $mEntity->listJsonUrl = 'list.php';
    $mEntity->path = '../../';
    $mEntity->staticsUrl = 'index.php?statics=true';
    $mEntity->editUrlParams = array("ID" => "ID");
    $mEntity->deleteUrlParams = array("ID" => "ID");
    $mEntity->table = "cllg_entity";
    $mEntity->validations = array("required,NAME,Nombre es Requerido",
        "required,LONG_DESCRIPCION,Descripcion es Requerido");
    $_SESSION['mEntity'] = serialize($mEntity);
} else {
    $mEntity = unserialize($_SESSION['mEntity']);
}

if (!isEmpty(getParam('statics'))) {
    $mEntity->statics(count($db->query_select('cllg_entity')));
} else {
    $mEntity->build();
}
?>